/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 * \file     Mcu.c                                                                                      *
 * \brief    AUTOSAR 4.3.1 MCAL Mcu Driver                                                              *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2023/07/31     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Mcal.h"
#include "Mcu.h"
#if (STD_ON == MCU_DEV_ERROR_DETECT)
/** Traceability       : SWSR_MCU_045*/
#include "Det.h"
#endif /**#if (STD_ON == MCU_DEV_ERROR_DETECT)*/
#if (STD_ON == MCU_SAFETY_ENABLE)
#include "FuSaMcalReportError.h"
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE)*/
#include "Mcu_Clk.h"
#include "Mcu_Xtal.h"
#include "Mcu_Rstgen.h"
#include "__regs_base.h"
#include "Mcu_Fault.h"
#include "cdefs.h"

/********************************************************************************************************
 *                                 Private Macro definition                                             *
 *******************************************************************************************************/
#define RC20M_TRIM_EN                   (1U<<3U)
#define RC24M_TRIM_EN                   (1U<<5U)
/********************************************************************************************************
 *                                 Imported Compiler Switch Checks                                      *
 *******************************************************************************************************/
#ifndef MCU_SW_MAJOR_VERSION
#error "MCU_SW_MAJOR_VERSION is not defined."
#endif

#ifndef MCU_SW_MINOR_VERSION
#error "MCU_SW_MINOR_VERSION is not defined."
#endif

#ifndef MCU_SW_PATCH_VERSION
#error "MCU_SW_PATCH_VERSION is not defined."
#endif

/* AUTOSAR Secification File Version Check */
#ifndef MCU_AR_RELEASE_MAJOR_VERSION
#error "MCU_AR_RELEASE_MAJOR_VERSION is not defined."
#endif

/* AUTOSAR Secification File Version Check */
#ifndef MCU_AR_RELEASE_MINOR_VERSION
#error "MCU_AR_RELEASE_MINOR_VERSION is not defined."
#endif

/* AUTOSAR Secification File Version Check */
#ifndef MCU_AR_RELEASE_REVISION_VERSION
#error "MCU_AR_RELEASE_REVISION_VERSION is not defined."
#endif

/** \brief  AUTOSAR Major and Minor release version check. */
#if(MCU_AR_RELEASE_MAJOR_VERSION != 4U)
#error "MCU_AR_RELEASE_MAJOR_VERSION does not match."
#endif

#if(MCU_AR_RELEASE_MINOR_VERSION != 3U)
#error "MCU_AR_RELEASE_MINOR_VERSION does not match."
#endif

#if(MCU_AR_RELEASE_REVISION_VERSION != 1U)
#error "MCU_AR_RELEASE_REVISION_VERSION does not match."
#endif
/********************************************************************************************************
 *                                  Private Variable Definitions                                        *
 *******************************************************************************************************/

#define MCU_START_SEC_VAR_NO_INIT_NO_CACHE_UNSPECIFIED
#include "Mcu_MemMap.h"
/** \brief  The configuration file pointer initialized in Mcu_init, and used in subsequent interfaces */
#if defined(_ARMGCC_C_)
static const Mcu_ConfigType *Mcu_CfgPtr __attribute__((aligned(32))) _SECTION(.dma_buffer);
#else
static const Mcu_ConfigType *Mcu_CfgPtr;
#endif

#define MCU_STOP_SEC_VAR_NO_INIT_NO_CACHE_UNSPECIFIED
#include "Mcu_MemMap.h"

/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/
#define MCU_START_SEC_CODE
#include "Mcu_MemMap.h"

/********************************************************************************************************
 *                                  Private Function Declarations                                       *
 *******************************************************************************************************/
/** *****************************************************************************************************
 * \brief This function check whether driver is initialized.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_EnterCheck(const uint8 serviceId)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : serviceId - Module Service Id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Return the errorId, which record current error status.
 *
 * Description        : This function shall check whether driver is initialized, if driver is
 *                      initialized when check in  MCU_SID_INIT service, return error; otherwise if
 *                      driver is not initialized when check in other services, return error.
 * \endverbatim
 * Traceability       : SWSR_MCU_046 SWSR_MCU_048 SW_SM002 SW_SM001
 *******************************************************************************************************/
static Std_ReturnType Mcu_EnterCheck(const uint8 serviceId)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus = E_OK;

    /* ----- Implementation ----------------------------------------------- */
    /* #10 Check Mcu_Init service*/
    if (MCU_SID_INIT == serviceId)
    {
        /* If "Mcu_Init" was already called (i.e. driver is initialized), return error. */
        McuHookBegin_Mcu_EnterCheck();

        if (NULL_PTR != Mcu_CfgPtr)
        {
            errStatus = MCU_E_INIT;
        }/* else not needed */

        McuHookEnd_Mcu_EnterCheck();
    }
    /* #20 Check other services*/
    else
    {
        /* If "Mcu_Init" was not called (i.e driver is uninitialized), return error. */
        McuHookBegin_Mcu_EnterCheck();

        if (NULL_PTR == Mcu_CfgPtr)
        {
            errStatus = MCU_E_UNINIT;
        }/* else not needed */

        McuHookEnd_Mcu_EnterCheck();
    }

    return errStatus;
}
/** *****************************************************************************************************
 * \brief reset used reset signal list.
 *
 * \verbatim
 * Syntax             : static Std_ReturnType Mcu_ResetUsedModule(const Mcu_ResetConfigType *rstDeassertPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : rstDeassertPtr - Reset signal list pointer.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : 0 if OK, or a error code.
 *
 * Description        : reset used reset signal list.
 *
 * \endverbatim
 * Traceability       : SWSR_MCU_053 SW_SM006
 *******************************************************************************************************/
static Std_ReturnType Mcu_ResetUsedModule(const Mcu_ResetConfigType *rstDeassertPtr)
{
    Std_ReturnType errStatus = E_OK;
    uint32 i;

    if (NULL_PTR != rstDeassertPtr)
    {
        /* Release 'reset' of every modules */
        for ( i = 0U; i < rstDeassertPtr->configNum; i++)
        {
            errStatus = Mcu_Ip_ResetCtlReset(rstDeassertPtr->configNodes[i]);

            if (E_OK != errStatus)
            {
                break;
            }/* else not needed */
        }

    }
    else
    {
        errStatus = MCU_E_PARAM_POINTER;
    }

    return errStatus;
}
/** *****************************************************************************************************
 * \brief assert unused reset signal list.
 *
 * \verbatim
 * Syntax             : static Std_ReturnType Mcu_AssertUnusedModule(const Mcu_ResetConfigType *rstAssertPtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : rstAssertPtr - assert signal list pointer.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : 0 if OK, or a error code.
 *
 * Description        : assert unused reset signal list.
 *
 * \endverbatim
 * Traceability       : SW_SM006
 *******************************************************************************************************/
static Std_ReturnType Mcu_AssertUnusedModule(const Mcu_ResetConfigType *rstAssertPtr)
{
    Std_ReturnType errStatus = E_OK;
    uint32 i;

    if (NULL_PTR != rstAssertPtr)
    {
        for (i = 0U; i < rstAssertPtr->configNum; i++)
        {
            errStatus = Mcu_Ip_ResetCtlAssert(rstAssertPtr->configNodes[i]);

            if (E_OK != errStatus)
            {
                break;
            } /* else not needed */
        }
    }
    else
    {
        errStatus = MCU_E_PARAM_POINTER;
    }

    return errStatus;
}
/** *****************************************************************************************************
 * \brief enable used cg list.
 *
 * \verbatim
 * Syntax             : static Std_ReturnType Mcu_EnableUsedClock(const Mcu_ClkCgConfigType *clkEnablePtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkEnablePtr - enable cg list pointer.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : 0 if OK, or a error code.
 *
 * Description        : enable used cg list.
 *
 * \endverbatim
 * Traceability       : SW_SM006
 *******************************************************************************************************/
static Std_ReturnType Mcu_EnableUsedClock(const Mcu_ClkCgConfigType *clkEnablePtr)
{
    Std_ReturnType errStatus = E_OK;
    uint32 i;
    uint32 j;
    const Mcu_ClkCgConfigNodeType *clkPtr;

    if (NULL_PTR != clkEnablePtr)
    {
        for (i = 0U; i < clkEnablePtr->configNum; i++)
        {
            clkPtr = &clkEnablePtr->configNodes[i];

            j = 0U;

            while ((NULL_PTR != clkPtr->clkNode[j]))
            {
                errStatus = Mcu_Ip_ClkEnable(clkPtr->clkNode[j]);
                j++;

                if (E_OK != errStatus)
                {
                    break;
                } /* else not needed */
            }

            if (E_OK != errStatus)
            {
                break;
            } /* else not needed */
        }
    }
    else
    {
        errStatus = MCU_E_PARAM_POINTER;
    }

    return errStatus;
}
/** *****************************************************************************************************
 * \brief disable unused cg list.
 *
 * \verbatim
 * Syntax             : static Std_ReturnType Mcu_DisableUnusedClock(const Mcu_ClkCgConfigType *clkDisablePtr)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkDisablePtr - disable cg list pointer.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : 0 if OK, or a error code.
 *
 * Description        : disable unused cg list.
 *
 * \endverbatim
 * Traceability       : SW_SM006
 *******************************************************************************************************/
static Std_ReturnType Mcu_DisableUnusedClock(const Mcu_ClkCgConfigType *clkDisablePtr)
{
    Std_ReturnType errStatus = E_OK;
    uint32 i;
    uint32 j;
    const Mcu_ClkCgConfigNodeType *clkPtr;

    if (NULL_PTR != clkDisablePtr)
    {
        for (i = 0U; i < clkDisablePtr->configNum; i++)
        {
            clkPtr = &clkDisablePtr->configNodes[i];

            j = 0U;

            while ((NULL_PTR != clkPtr->clkNode[j]))
            {
                errStatus = Mcu_Ip_ClkDisable(clkPtr->clkNode[j]);
                j++;

                if (E_OK != errStatus)
                {
                    break;
                } /* else not needed */
            }

            if (E_OK != errStatus)
            {
                break;
            } /* else not needed */
        }
    }
    else
    {
        errStatus = MCU_E_PARAM_POINTER;
    }

    return errStatus;
}

/** *****************************************************************************************************
 * \brief This service initializes the RAM section wise.
 *
 * \verbatim
 * Syntax             : static Std_ReturnType Mcu_RamSectionConfig(const Mcu_RamConfigType *cfgPtr)
 *
 * Service ID[hex]    : 0x01
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : cfgPtr - RAM memory config pointer
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : ErrorId
 *
 * Description        : This service initializes the RAM section wise.
 * \endverbatim
 * Traceability       : SW_SM006
 *******************************************************************************************************/
static Std_ReturnType Mcu_RamSectionConfig(const Mcu_RamConfigType *cfgPtr)
{
    Std_ReturnType errStatus = E_OK;
    uint32 i;
    uint32 writeCnt;
    uint64 value;
    uint8 *basePtr1;
    uint16 *basePtr2;
    uint32 *basePtr3;
    uint64 *basePtr4;

    writeCnt = cfgPtr->size / cfgPtr->writeSize;

    switch (cfgPtr->writeSize)
    {
    case 1U:
        /* #10  writing at once a number of 1 byte*/
        value = cfgPtr->defaultValue;
        /* PRQA S 0306 1 */
        basePtr1 = (uint8 *)cfgPtr->base;

        for (i = 0U; i < writeCnt; i++)
        {
            *basePtr1 = (uint8)value;
            basePtr1++;
        }

        break;

    case 2U:
        /* #20  writing at once a number of 2 bytes*/
        value = cfgPtr->defaultValue;
        value = value | (value << 8U);
        /* PRQA S 0306 1 */
        basePtr2 = (uint16 *)cfgPtr->base;

        if ((0U != (cfgPtr->base % 2U)) || (0U != (cfgPtr->size % 2U)))
        {
            errStatus = MCU_E_PARAM_RAMSECTION;
        }
        else
        {
            for (i = 0U; i < writeCnt; i++)
            {
                *basePtr2 = (uint16)value;
                basePtr2++;
            }
        }

        break;

    case 4U:
        /* #30  writing at once a number of 4 bytes*/
        value = cfgPtr->defaultValue;
        value = value | (value << 8U);
        value = value | (value << 16U);
        /* PRQA S 0306 1 */
        basePtr3 = (uint32 *)cfgPtr->base;

        if ((0U != (cfgPtr->base % 4U)) || (0U != (cfgPtr->size % 4U)))
        {
            errStatus = MCU_E_PARAM_RAMSECTION;
        }
        else
        {
            for (i = 0U; i < writeCnt; i++)
            {
                *basePtr3 = (uint32)value;
                basePtr3++;
            }
        }

        break;

    case 8U:
        /* #40  writing at once a number of 8 bytes*/
        value = cfgPtr->defaultValue;
        value = value | (value << 8U);
        value = value | (value << 16U);
        value = value | (value << 32U);
        /* PRQA S 0306 1 */
        basePtr4 = (uint64 *)cfgPtr->base;

        if ((0U != (cfgPtr->base % 8U)) || (0U != (cfgPtr->size % 8U)))
        {
            errStatus = MCU_E_PARAM_RAMSECTION;
        }
        else
        {
            for (i = 0U; i < writeCnt; i++)
            {
                *basePtr4 = value;
                basePtr4++;
            }
        }

        break;

    default:
        errStatus = MCU_E_PARAM_RAMSECTION;
        break;
    }

    return errStatus;
}

/** *****************************************************************************************************
 * \brief This function set global reset enable bit.
 *
 * \verbatim
 * Syntax             : static void Mcu_Ip_GlbResetEn(void)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        :This function set global reset enable bit. sf send sw global reset req, need lp set rst_req_en
 * \endverbatim
 *******************************************************************************************************/
static void Mcu_Ip_GlbResetEn(void)
{
    uint32 val;
    val = readl(APB_RSTGEN_SAFETY_BASE + GLOBAL_RESET_CONTROL_OFF);
    val &= ~(0x7FFFFU);
    val |= (MCU_GLOBAL_RESET_EN_VALUE & (0x7FFFFU));
    val &= ~((7UL << 8U) | (7UL << 16U)); /* pvt reset is nonmask reset, bit8 in EB is virtual for setting LP bit19. bit8/9/10, bit 16/17/18 is reserved */

    writel(val, APB_RSTGEN_SAFETY_BASE + GLOBAL_RESET_CONTROL_OFF);

#if (0U != MCU_GLOBAL_RESET_EN_VALUE)
    val = readl(APB_RSTGEN_LP_BASE + GLOBAL_RESET_CONTROL_OFF);
    val &= ~FM_GLOBAL_RESET_CONTROL_RST_REQ_EN;
    val |= FV_GLOBAL_RESET_CONTROL_RST_REQ_EN(1U);
    /* #10 Using bit 31 to indicate wdt1 rst en for RSTGEN_LP */
    /*PRQA S 2880 6*/
    /*PRQA S 2742 1*/
    if ((MCU_GLOBAL_RESET_EN_VALUE & 0x80000000UL) != 0U)
    {
        val |= FV_GLOBAL_RESET_CONTROL_WDT1_EN(1U);
        val |= FV_GLOBAL_RESET_CONTROL_WDT2_EN(1U);
    }

    writel(val, APB_RSTGEN_LP_BASE + GLOBAL_RESET_CONTROL_OFF);
#endif

}

/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/

/** *****************************************************************************************************
 * \brief This service initializes the MCU driver.
 *
 * \verbatim
 * Syntax             : void Mcu_Init(const Mcu_ConfigType* ConfigPtr)
 *
 * Service ID[hex]    : 0x00
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : configPtr - Pointer to configuration set
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : Driver Module Initialization function.The Initialization function shall
 *                      initialize the MCU module, i.e.make the configuration settings for
 *                      clock and RAM sections visible within the MCU module.
 * \endverbatim
 * Traceability       : SWSR_MCU_021 SWSR_MCU_054 SWSR_MCU_055 SW_SM002
 *                      SW_SM006
 *******************************************************************************************************/
void Mcu_Init(const Mcu_ConfigType *ConfigPtr)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    uint32 scrVal;
    uint8 fuseVal;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module init states */
    errStatus = Mcu_EnterCheck(MCU_SID_INIT);

    if (E_OK == errStatus)
    {
        /* #20 Check input parameters for plausibility */
        if (NULL_PTR == ConfigPtr)
        {
            errStatus = MCU_E_INIT_FAILED;
        }
        else
        {
            /* ----- Implementation ----------------------------------------------- */
            Mcu_Ip_GlbResetEn();

            #if (CKGEN_24M_RATE == 20000000)
            /* RC20M trim , FS_24M_BASE 0x10[7:0] = RC20M_FREQ_TUNE_B[7:0]*/
            fuseVal = readb(APB_EFUSEC_BASE + 0x1302UL);
            if((fuseVal & RC20M_TRIM_EN) != 0U) {
                fuseVal = readb(APB_EFUSEC_BASE + 0x1301UL) >> 4U;
                fuseVal |= (readb(APB_EFUSEC_BASE + 0x1302UL) & 0xf0U);
                writeb(fuseVal, APB_FS_24M_BASE + 0x10UL);
            }
            #endif
            /* RC24M trim, SCR_BASE 0x107c[10:6] = 0x18; */
            fuseVal = readb(APB_EFUSEC_BASE + 0x1041UL);
            if((fuseVal & RC24M_TRIM_EN) != 0U) {
                scrVal = readl(APB_SCR_SAETY_BOOT_BASE + 0x107cUL) & (~0x7c0UL);
                scrVal |= 0x18UL << 6;
                writel(scrVal, APB_SCR_SAETY_BOOT_BASE + 0x107cUL);
            }

            /* #90 Save configuration pointer in global variable */
            Mcu_CfgPtr = ConfigPtr;
        }
    }/* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #100 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_INIT,
                              (uint8)errStatus);
#endif /** #if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_INIT,
                                   (uint8)errStatus);
#endif /** #if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
}

/** *****************************************************************************************************
 * \brief This service initializes the PLL and other MCU specific clock options.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_InitClock(Mcu_ClockType ClockSetting)
 *
 * Service ID[hex]    : 0x02
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : ClockSetting - Clock setting id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : ErrorId
 *
 * Description        : This service initializes the PLL and other MCU specific clock options.
 * \endverbatim
 * Traceability       : SWSR_MCU_004 SWSR_MCU_025 SWSR_MCU_026 SWSR_MCU_027
 *                      SWSR_MCU_046 SWSR_MCU_053 SWSR_MCU_054 SWSR_MCU_055
 *                      SW_SM006 SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_InitClock(Mcu_ClockType ClockSetting)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    /* Variable used to store current clock configuration */
    const Mcu_ClockConfigType *clkConfigsPtr;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module init states */
    errStatus = Mcu_EnterCheck(MCU_SID_INIT_CLOCK);

    /* #20 Check input parameters for plausibility */
    if (E_OK == errStatus)
    {

        if (ClockSetting >= Mcu_CfgPtr->numClkCfgs)
        {
            errStatus = MCU_E_PARAM_CLOCK;
        }
        else
        {
            clkConfigsPtr = Mcu_CfgPtr->clkCfgsPtr[0];
            /* PRQA S 0488 1*/
            clkConfigsPtr = clkConfigsPtr + ClockSetting;
        }
    } /* else not needed */

    /* ----- Implementation ----------------------------------------------- */
    /* #30 Enable used clock.*/
    CALL_RET_CHECK(errStatus, Mcu_EnableUsedClock(clkConfigsPtr->clkEnable));

    /* #40 disable unused clock */
    CALL_RET_CHECK(errStatus, Mcu_DisableUnusedClock(clkConfigsPtr->clkDisable));

    /* #50 assert unused module */
    CALL_RET_CHECK(errStatus, Mcu_AssertUnusedModule(clkConfigsPtr->rstAssert));

    /* #60 Prepare clock tree. */
    CALL_RET_CHECK(errStatus, Mcu_PrepareClockTree(clkConfigsPtr->clkPrepare));

    /* #70 reset used module */
    CALL_RET_CHECK(errStatus, Mcu_ResetUsedModule(clkConfigsPtr->rstDeassert));

    /* ----- Development Error Report --------------------------------------- */
    /* #100 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_INIT_CLOCK,
                              (uint8)errStatus);
#endif /** #if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_INIT_CLOCK,
                                   (uint8)errStatus);
#endif /** #if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #110 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */

    return errStatus;
}

/** *****************************************************************************************************
 * \brief This service initializes the RAM section wise.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_InitRamSection(Mcu_RamSectionType RamSection)
 *
 * Service ID[hex]    : 0x01
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : RamSection - Selects RAM memory section provided in configuration set
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : ErrorId
 *
 * Description        : This service initializes the RAM section wise.
 * \endverbatim
 * Traceability       : SWSR_MCU_022 SWSR_MCU_023 SWSR_MCU_024 SWSR_MCU_046
 *                      SWSR_MCU_047 SWSR_MCU_054 SWSR_MCU_055 SW_SM006
 *                      SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_InitRamSection(Mcu_RamSectionType RamSection)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    /* Variable used to store ram configuration */
    const Mcu_RamConfigType *cfgPtr;
    uint32 i;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module states */
    errStatus = Mcu_EnterCheck(MCU_SID_INIT_RAM_SECTION);

    if (E_OK == errStatus)
    {
        if ((0U == Mcu_CfgPtr->numRamSections) || (NULL_PTR == Mcu_CfgPtr->ramCfgsPtr))
        {
            errStatus = MCU_E_PARAM_RAMSECTION;
        }
        else
        {
            /* #20 Check input parameters for plausibility */
            cfgPtr = (const Mcu_RamConfigType *)Mcu_CfgPtr->ramCfgsPtr;

            for (i = 0; i < Mcu_CfgPtr->numRamSections; i++)
            {
                if (RamSection == cfgPtr->idx)
                {
                    break;
                } /* else not needed */

                cfgPtr++;
            }

            if (i >= Mcu_CfgPtr->numRamSections)
            {
                errStatus = MCU_E_PARAM_RAMSECTION;
            }
            else
            {
                /* ----- Implementation ----------------------------------------------- */
                /* #30  initializes the RAM section wise */
                errStatus = Mcu_RamSectionConfig(cfgPtr);
            }
        }

    }/* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #40 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_INIT_RAM_SECTION,
                              (uint8)errStatus);
#endif /**#if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_INIT_RAM_SECTION, (uint8)errStatus);
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #50 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return errStatus;
}

/** *****************************************************************************************************
 * \brief This service provides the lock status of the PLL.
 *
 * \verbatim
 * Syntax             : Mcu_PllStatusType Mcu_GetPllStatus(void)
 *
 * Service ID[hex]    : 0x04
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : PLL lock status
 *
 * Description        : This service provides the lock status of the PLL.
 * \endverbatim
 * Traceability       : SWSR_MCU_010 SWSR_MCU_028 SWSR_MCU_029 SWSR_MCU_030
 *                      SWSR_MCU_031 SWSR_MCU_054 SWSR_MCU_055 SW_SM001
 *******************************************************************************************************/
Mcu_PllStatusType Mcu_GetPllStatus(void)
{
    /* ----- Local Variables ---------------------------------------------- */
#if (STD_OFF == MCU_NO_PLL)
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    /* Variable used to store current pll lock status */
    boolean isLocked;
#endif
    Mcu_PllStatusType pllStatus = MCU_PLL_STATUS_UNDEFINED;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module states */
#if (STD_OFF == MCU_NO_PLL)
    errStatus = Mcu_EnterCheck(MCU_SID_GET_PLL_STATUS);

    if (E_OK == errStatus)
    {
        /* ----- Implementation ----------------------------------------------- */
        /* #20  Check pll lock states */
        isLocked = Mcu_Ip_ClkIsLocked(CLK_NODE(g_pll1_vco));
        isLocked &= Mcu_Ip_ClkIsLocked(CLK_NODE(g_pll2_vco));
        isLocked &= Mcu_Ip_ClkIsLocked(CLK_NODE(g_pll3_vco));

        /* #30 if all pll locked, return locked. otherwise, return unlocked.*/
        if (TRUE == isLocked)
        {
            pllStatus = MCU_PLL_LOCKED;
        }
        else
        {
            pllStatus = MCU_PLL_UNLOCKED;
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #40 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GET_PLL_STATUS,
                              (uint8)errStatus);
#endif /**#if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_GET_PLL_STATUS, (uint8)errStatus);
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #50 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
#endif /** #if (STD_OFF == MCU_NO_PLL) */
    return pllStatus;
}

/** *****************************************************************************************************
 * \brief The service reads the reset type from the hardware, if supported.
 *
 * \verbatim
 * Syntax             : Mcu_ResetType Mcu_GetResetReason(void)
 *
 * Service ID[hex]    : 0x05
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : reset type
 *
 * Description        : The service reads the reset type from the hardware, if supported.
 * \endverbatim
 * Traceability       : SWSR_MCU_003 SWSR_MCU_032 SWSR_MCU_033 SWSR_MCU_034
 *                      SW_SM001
 *******************************************************************************************************/
Mcu_ResetType Mcu_GetResetReason(void)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    Mcu_ResetType resetType = MCU_RESET_UNDEFINED;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module states */
    errStatus = Mcu_EnterCheck(MCU_SID_GET_RESET_REASON);

    if (E_OK == errStatus)
    {
        /* ----- Implementation ----------------------------------------------- */
        /* #20  read raw reset reason from register */
        resetType = Mcu_Ip_GetResetReason(APB_RSTGEN_SAFETY_BASE);
    }/* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #40 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GET_RESET_REASON,
                              (uint8)errStatus);
#endif /**#if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_GET_RESET_REASON, (uint8)errStatus);
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #50 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */

    return resetType;
}

/** *****************************************************************************************************
 * \brief The service reads the reset type from the hardware register, if supported.
 *
 * \verbatim
 * Syntax             : Mcu_RawResetType Mcu_GetResetRawValue(void)
 *
 * Service ID[hex]    : 0x06
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Reset raw value
 *
 * Description        : The service reads the reset type from the hardware register, if supported.
 * \endverbatim
 * Traceability       : SWSR_MCU_035 SWSR_MCU_036 SWSR_MCU_037 SW_SM001
 *******************************************************************************************************/
Mcu_RawResetType Mcu_GetResetRawValue(void)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;
    /* Variable used to store current reset type */
    Mcu_RawResetType resetRawType = 0xF0000000U;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module states */
    errStatus = Mcu_EnterCheck(MCU_SID_GET_RESET_RAW_VALUE);

    if (E_OK == errStatus)
    {
        /* ----- Implementation ----------------------------------------------- */
        /* #20  read raw reset reason from register */
        resetRawType = Mcu_Ip_GetResetRawValue(APB_RSTGEN_SAFETY_BASE);
    }/* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #30 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                              (uint8)MCU_SID_GET_RESET_RAW_VALUE, (uint8)errStatus);
#endif /**#if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_GET_RESET_RAW_VALUE, (uint8)errStatus);
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #40 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return resetRawType;
}

/** Traceability       : SWSR_MCU_041*/
#if (STD_ON == MCU_PERFORM_RESET_API)
/** *****************************************************************************************************
 * \brief The service performs a microcontroller reset.
 *
 * \verbatim
 * Syntax             : Mcu_RawResetType Mcu_GetResetRawValue(void)
 *
 * Service ID[hex]    : 0x07
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : Reset raw value
 *
 * Description        : The service performs a microcontroller reset.
 *                      The function Mcu_PerformReset is only available if MCU_PERFORM_RESET_API is set to TRUE.
 *                      If set to FALSE, the function Mcu_PerformReset is not applicable
 * \endverbatim
 * Traceability       : SWSR_MCU_002 SWSR_MCU_038 SWSR_MCU_039 SWSR_MCU_040
 *                      SWSR_MCU_054 SWSR_MCU_055 SW_SM001
 *******************************************************************************************************/
void Mcu_PerformReset(void)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check module states */
    errStatus = Mcu_EnterCheck(MCU_SID_PERFORM_RESET);

    if (E_OK == errStatus)
    {
        /* ----- Implementation ----------------------------------------------- */
        /* #20  global reset */
        errStatus = Mcu_Ip_ResetCtlGlobalReset(&rstctl_glb);
    }/* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #30 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_PERFORM_RESET,
                              (uint8)errStatus);
#endif /** #if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_PERFORM_RESET,
                                   (uint8)errStatus);
#endif /** #if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #40 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
}
#endif /**#if (STD_ON == MCU_PERFORM_RESET_API)*/

#ifndef CFG_MCULP_MODULE_EN
/** *****************************************************************************************************
 * \brief This service activates the MCU power modes.
 *
 * \verbatim
 * Syntax             : __WEAK void Mcu_SetMode(Mcu_ModeType McuMode)
 *
 * Service ID[hex]    : 0x08
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : This service activates the MCU power modes(run mode)
 * \endverbatim
 *******************************************************************************************************/
/* PRQA S 3206 1 */
__WEAK void Mcu_SetMode(Mcu_ModeType McuMode)
{
    ; /* do nothing */
}
#endif

#if (STD_ON == MCU_VERSION_INFO_API)
/** *****************************************************************************************************
 * \brief Get version information of this driver.
 *
 * \verbatim
 * Syntax             : void Mcu_GetVersionInfo(Std_VersionInfoType *versioninfo)
 *
 * Service ID[hex]    : 0x09
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : versioninfo - Pointer to where to store the version information of this module.
 *
 * Return value       : None
 *
 * Description        : This function returns the version information of this module
 *                      The version information include : Module ID, Vendor ID.
 *                      Vendor specific version numbers.
 *   -                  This function is available if the MCU_VERSION_INFO_API is set STD_ON
 *
 * \endverbatim
 * Traceability       : SWSR_MCU_044
 *******************************************************************************************************/
void Mcu_GetVersionInfo(Std_VersionInfoType *versioninfo)
{
    /* ----- Local Variables ---------------------------------------------- */
    /* Variable used to store current error status */
    Std_ReturnType errStatus = E_OK;

    /* ----- Development Error Checks ------------------------------------- */
    /* #10 Check input parameters for plausibility */
    if (NULL_PTR == versioninfo)
    {
        errStatus = MCU_E_PARAM_POINTER;
    }
    else
    {
        /* ----- Implementation ----------------------------------------------- */
        /* #20 Retrieve version information */
        versioninfo->vendorID = MCU_VENDOR_ID;
        versioninfo->moduleID = MCU_MODULE_ID;
        versioninfo->sw_major_version = MCU_SW_MAJOR_VERSION;
        versioninfo->sw_minor_version = MCU_SW_MINOR_VERSION;
        versioninfo->sw_patch_version = MCU_SW_PATCH_VERSION;
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #30 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, MCU_SID_GET_VERSION_INFO,
                              MCU_E_PARAM_POINTER);
#endif /**#if STD_ON == MCU_DEV_ERROR_DETECT*/
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, MCU_SID_GET_VERSION_INFO,
                                   MCU_E_PARAM_POINTER);
#endif /**#if (STD_ON == MCU_SAFETY_ENABLE) */
    } /* else not needed */

#else
    {
        /* #40 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
}
#endif /**#if (STD_ON == MCU_VERSION_INFO_API) */

/** *****************************************************************************************************
 * \brief Clk set rate interface, set one clk node rate. will adaptively select parents.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_ClkSetRate(const Mcu_ClkNodeType *clkPtr, Mcu_ClkRateType rate, uint32 reserved1,
                              uint32 reserved2, uint32 reserved3)
 *
 * Service ID[hex]    : None
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node
 *                      rate - The clk rate to be set. for pll: pll vco rate.
 *                      reserved1 - for pll: ck0 rate.  for bus slice: cpu/axi/apb ratio. for ip slice: not used.
 *                      reserved2 - for pll: ck1 rate.  for bus slice: not used. for ip slice: not used.
 *                      reserved3 - for pll: spread config pointer. for bus slice: not used. for ip slice: not used.
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errID
 *
 * Description        : Clock node frequency set. set one clk node(bus slice, ip slice or pll) rate.
 *                      will adaptively select parents.
 *                      This api not set the parent clock node, but will use the parent clock
 *                      node's rate to calculate divider's param.
 *                      you need consider clock divisible, to get high accuracy clock.
 *                      Some clk node may be not support Mcu_Ip_ClkSetRate api when it has child node.
 *                      This api always used for clock tree leaf node.
 *                      When setting the pll vco rate, ck0/ck1 should be set at the same time;
 *                      ck0/ck1 can also be set separately use this interface.
 *                      Be careful not to overclock and must be set according to TRM recommended flow.
 *                      Example: Mcu_ClkSetRate(CLK_NODE(g_ckgen_ip_enet1_tx), 250000000, 0, 0, 0)
 *                               Mcu_ClkSetRate(CLK_NODE(g_ckgen_bus_cr5_se_seip_r52), 600000000, CKGEN_BUS_DIV_4_2_1, 0, 0)
 *                               Mcu_ClkSetRate(CLK_NODE(g_pll1_vco), 2400000000, 400000000, 600000000, NULL_PTR)
 *                               Mcu_ClkSetRate(CLK_NODE(g_pll1_pll_ck0), 0, 400000000, 0, NULL_PTR)
 *                               Mcu_ClkSetRate(CLK_NODE(g_pll1_pll_ck1), 0, 0, 600000000, NULL_PTR)
 * \endverbatim
 * Traceability       : SW_SM006
 *******************************************************************************************************/
Std_ReturnType Mcu_ClkSetRate(const Mcu_ClkNodeType *clkPtr, Mcu_ClkRateType rate, uint32 reserved1,
                              uint32 reserved2, uint32 reserved3)
{
    Std_ReturnType errStatus;
    errStatus = Mcu_EnterCheck(MCU_SID_SET_RATE);

    if (E_OK == errStatus)
    {
        errStatus = Mcu_Ip_ClkSetRate(clkPtr, rate, reserved1, reserved2, reserved3);
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_SET_RATE,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_SET_RATE,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  errStatus;
}
/** *****************************************************************************************************
 * \brief This function get clock rate(calculated by register value).
 *
 * \verbatim
 * Syntax             : Mcu_ClkRateType Mcu_ClkGetRate(const Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : 0x12
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node to get rate
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : clock rate value
 *
 * Description        : This function get clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_004 SW_SM001
 *******************************************************************************************************/
Mcu_ClkRateType Mcu_ClkGetRate(const Mcu_ClkNodeType *clkPtr)
{
    Std_ReturnType errStatus;
    Mcu_ClkRateType rate = UINT32_MAX;
    errStatus = Mcu_EnterCheck(MCU_SID_GET_RATE);

    if (E_OK == errStatus)
    {
        rate = Mcu_Ip_ClkGetRate(clkPtr);

        if (rate == UINT32_MAX)
        {
            errStatus = MCU_E_OUTRANGE;
        } /* else not needed */
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GET_RATE,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GET_RATE,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return rate;
}

/** *****************************************************************************************************
 * \brief This function get clock rate(real rate by monitor).
 *
 * \verbatim
 * Syntax             : Mcu_ClkRateType Mcu_ClkGetMonitorRate(const Mcu_ClkNodeType *clkPtr)
 *
 * Service ID[hex]    : 0x18
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : clkPtr - Pointer to clock node to get rate
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : clock rate value
 *
 * Description        : This function get clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_004 SW_SM001
 *******************************************************************************************************/
Mcu_ClkRateType Mcu_ClkGetMonitorRate(const Mcu_ClkNodeType *clkPtr)
{
    Std_ReturnType errStatus;
    Mcu_ClkRateType rate = UINT32_MAX;
    errStatus = Mcu_EnterCheck(MCU_SID_GET_MONITOR_RATE);

    if (E_OK == errStatus)
    {
        rate = Mcu_Ip_ClkGetMonitorRate(clkPtr);

        if (rate == UINT32_MAX)
        {
            errStatus = MCU_E_OUTRANGE;
        } /* else not needed */
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GET_MONITOR_RATE,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_GET_MONITOR_RATE,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return rate;
}

/** *****************************************************************************************************
 * \brief This function enable/disable monitor clock source ready and clock active.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_CkgenMonReadyEnable(const Mcu_CkgenMonReadyType *ckgenMonReadyPtr, boolean enable)
 *
 * Service ID[hex]    : 0x20
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonReadyPtr - Pointer to clock monitor node
 *                      enable - TRUE/FALSE
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_PCG_TYPE/CKGEN_BCG_TYPE/CKGEN_PLL_CG_TYPE/CKGEN_XTAL_CG_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 wdtTimeout;(wdtTimeout for xtal/pll ready)
                            uint8  monIntRes;(interrupt status, 0-no err, other-error occured)
                            uint32 realState;(real state)
                        } Mcu_CkgenMonReadyType;
 *
 * Parameters (out)   : None
 *
 * Return value       : errId. 0-OK, others- error
 *
 * Description        : This function enable/disable monitor clock source ready and clock active.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_CkgenMonReadyEnable(const Mcu_CkgenMonReadyType *ckgenMonReadyPtr, boolean enable)
{
    Std_ReturnType errStatus;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_READY_EN);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonReadyPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            errStatus = Mcu_Ip_CkgenDrvMonEnable(ckgenMonReadyPtr->base, ckgenMonReadyPtr->type,
                                                 ckgenMonReadyPtr->typeIndex, ckgenMonReadyPtr->wdtTimeout, enable);
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_READY_EN,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_MONITOR_READY_EN,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  errStatus;

}
/** *****************************************************************************************************
 * \brief This function monitor clock source ready and clock active.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_CkgenMonReady(Mcu_CkgenMonReadyType *ckgenMonReadyPtr)
 *
 * Service ID[hex]    : 0x19
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonFreqPtr - Pointer to clock monitor node
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_PCG_TYPE/CKGEN_BCG_TYPE/CKGEN_PLL_CG_TYPE/CKGEN_XTAL_CG_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 wdtTimeout;(wdtTimeout for xtal/pll ready)
                            uint8  monIntRes;(interrupt status, 0-no err, other-error occured)
                            uint32 realState;(real state)
                        } Mcu_CkgenMonReadyType;
 *
 * Parameters (out)   : None
 *
 * Return value       : clock monitor status
 *                      0 - the monitor status is ok
 *                      !0 - the monitor status is not ok
 *
 * Description        : This function monitor clock source ready and clock active.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
uint8 Mcu_CkgenMonReady(Mcu_CkgenMonReadyType *ckgenMonReadyPtr)
{
    Std_ReturnType errStatus;
    uint8 ret = 0xFFU;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_READY);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonReadyPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            ret = Mcu_Ip_CkgenMonDrvReady(ckgenMonReadyPtr);

            if (0xFFU == ret)
            {
                errStatus = MCU_E_OUTRANGE;
            }
            else
            {
                errStatus = E_OK;
            }
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_READY,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_READY,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  ret;

}

/** *****************************************************************************************************
 * \brief This function enable/disable monitor clock rate.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_CkgenMonFreqEnable(const Mcu_CkgenMonFreqType *ckgenMonFreqPtr, boolean enable)
 *
 * Service ID[hex]    : 0x21
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonFreqPtr - Pointer to clock monitor node
 *                      enable - TRUE/FALSE
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_IP_SLICE_TYPE/CKGEN_BUS_SLICE_TYPE/CKGEN_SF_BUS_SLICE_TYPE/CKGEN_FS24M_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 sliceFreq;(Expected frequency)
                            uint8  freqTolerantRat;(Threshold percentage)
                            uint8  monIntRes;(interrupt status, 0-Frequency within threshold range, 1-Frequency out of threshold range, 0xFF-error occured)
                            uint32 realFreq;(real frequency)
                        } Mcu_CkgenMonFreqType;
 *
 * Parameters (out)   : None
 *
 * Return value       : errId. 0-OK, others- error
 *
 * Description        : This function enable/disbale monitor clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_CkgenMonFreqEnable(const Mcu_CkgenMonFreqType *ckgenMonFreqPtr, boolean enable)
{
    Std_ReturnType errStatus;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_FREQ_EN);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonFreqPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            errStatus = Mcu_Ip_CkgenDrvMonEnable(ckgenMonFreqPtr->base, ckgenMonFreqPtr->sliceType,
                                                 ckgenMonFreqPtr->typeIndex, 0U, enable);
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_FREQ_EN,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_MONITOR_FREQ_EN,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  errStatus;

}

/** *****************************************************************************************************
 * \brief This function monitor clock rate.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_CkgenMonFreq(Mcu_CkgenMonFreqType *ckgenMonFreqPtr)
 *
 * Service ID[hex]    : 0x13
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonFreqPtr - Pointer to clock monitor node
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_IP_SLICE_TYPE/CKGEN_BUS_SLICE_TYPE/CKGEN_SF_BUS_SLICE_TYPE/CKGEN_FS24M_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 sliceFreq;(Expected frequency)
                            uint8  freqTolerantRat;(Threshold percentage)
                            uint8  monIntRes;(interrupt status, 0-Frequency within threshold range, 1-Frequency out of threshold range, 0xFF-error occured)
                            uint32 realFreq;(real frequency)
                        } Mcu_CkgenMonFreqType;
 *
 * Parameters (out)   : None
 *
 * Return value       : clock monitor status
 *                      0 - the monitor status of clock rate is ok
 *                      !0 - the monitor status of clock rate is not ok
 *
 * Description        : This function monitor clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
uint8 Mcu_CkgenMonFreq(Mcu_CkgenMonFreqType *ckgenMonFreqPtr)
{
    Std_ReturnType errStatus;
    uint8 ret = 0xFFU;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_FREQ);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonFreqPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            ret = Mcu_Ip_CkgenDrvMonFreq(ckgenMonFreqPtr);

            if (0xFFU == ret)
            {
                errStatus = MCU_E_OUTRANGE;
            }
            else
            {
                errStatus = E_OK;
            }
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_FREQ,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_FREQ,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  ret;

}

/** *****************************************************************************************************
 * \brief This function enable/disable dbgMon monitor clock rate.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_CkgenDbgMonFreqEnable(const Mcu_CkgenMonFreqType *ckgenMonFreqPtr, boolean enable)
 *
 * Service ID[hex]    : 0x23
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonFreqPtr - Pointer to clock monitor node
 *                      enable - TRUE/FALSE
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_IP_SLICE_TYPE/CKGEN_BUS_SLICE_TYPE/CKGEN_SF_BUS_SLICE_TYPE/CKGEN_EXT_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 sliceFreq;(Expected frequency)
                            uint8  freqTolerantRat;(Threshold percentage)
                            uint8  monIntRes;(interrupt status, 0-Frequency within threshold range, 1-Frequency out of threshold range, 0xFF-error occured)
                            uint32 realFreq;(real frequency)
                        } Mcu_CkgenMonFreqType;
 *
 * Parameters (out)   : None
 *
 * Return value       : errId. 0-OK, others- error
 *
 * Description        : This function enable/disbale dbgMon monitor clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_CkgenDbgMonFreqEnable(const Mcu_CkgenMonFreqType *ckgenMonFreqPtr, boolean enable)
{
    Std_ReturnType errStatus;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_DBG_MON_EN);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonFreqPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            errStatus = Mcu_Ip_CkgenDrvDbgMonEnable(ckgenMonFreqPtr->base, enable);
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_DBG_MON_EN,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_MONITOR_DBG_MON_EN,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  errStatus;

}

/** *****************************************************************************************************
 * \brief This function monitor dbgMon clock rate.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_CkgenDbgMonFreq(Mcu_CkgenMonFreqType *ckgenMonFreqPtr)
 *
 * Service ID[hex]    : 0x24
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenMonFreqPtr - Pointer to clock monitor node
 *                      typedef struct
                        {
                            uint32 base;
                            Mcu_ClkSliceType sliceType;(CKGEN_IP_SLICE_TYPE/CKGEN_BUS_SLICE_TYPE/CKGEN_SF_BUS_SLICE_TYPE/CKGEN_EXT_TYPE)
                            uint32 typeIndex;(slice id)
                            uint32 sliceFreq;(Expected frequency)
                            uint8  freqTolerantRat;(Threshold percentage)
                            uint8  monIntRes;(interrupt status, 0-Frequency within threshold range, 1-Frequency out of threshold range, 0xFF-error occured)
                            uint32 realFreq;(real frequency)
                        } Mcu_CkgenMonFreqType;
 *
 * Parameters (out)   : None
 *
 * Return value       : clock monitor status
 *                      0 - the monitor status of clock rate is ok
 *                      !0 - the monitor status of clock rate is not ok
 *
 * Description        : This function monitor clock rate.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
uint8 Mcu_CkgenDbgMonFreq(Mcu_CkgenMonFreqType *ckgenMonFreqPtr)
{
    Std_ReturnType errStatus;
    uint8 ret = 0xFFU;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_DBG_MON);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenMonFreqPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            ret = Mcu_Ip_CkgenDrvDbgMonFreq(ckgenMonFreqPtr);

            if (0xFFU == ret)
            {
                errStatus = MCU_E_OUTRANGE;
            }
            else
            {
                errStatus = E_OK;
            }
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_DBG_MON,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_MONITOR_DBG_MON,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  ret;

}
/** *****************************************************************************************************
 * \brief This function enable/disable monitor clock cqm.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_CkgenMonCqmEnable(const Mcu_CkgenCqmType *ckgenCqmPtr, boolean enable)
 *
 * Service ID[hex]    : 0x22
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenCqmPtr - pointer to ckgencqm struct
 *                      enable - TRUE/FALSE
 *                      typedef struct
 *                      {
 *                          uint32 base;                (ckgen base )
 *                          uint32 cqmIndex;            (cqmIndex 0/1/2)
 *                          Mcu_CkgenType sliceType;    (slice type )
 *                          uint32 typeIndex;           (slice index )
 *                          uint8 dutyPercent;          (dutyPercent )
 *                          uint8 jitterPercent;        (jitterPercent )
 *                          uint8 dutyIntRes;           (interrupt status, 0-duty within threshold range, 1-duty out of threshold range, 0xFF-error occured )
 *                          uint8 jitterIntRes;         (interrupt status, 0-jitter within threshold range, 1-jitter out of threshold range, 0xFF-error occured )
 *                      } Mcu_CkgenCqmType;
 *
 * Parameters (out)   : None
 *
 * Return value       : clock monitor status
 *                      0 - the monitor status of clock cqm is ok
 *                      !0 - the monitor status of clock cqm is not ok
 *
 * Description        : This function monitor clock cqm.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
uint8 Mcu_CkgenMonCqmEnable(const Mcu_CkgenCqmType *ckgenCqmPtr, boolean enable)
{
    Std_ReturnType errStatus;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_CQM_EN);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenCqmPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            Mcu_Ip_CkgenDrvCqmEnable(ckgenCqmPtr->base, ckgenCqmPtr->cqmIndex, ckgenCqmPtr->dutyPercent,
                                     ckgenCqmPtr->jitterPercent, enable);
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_CQM_EN,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_MONITOR_CQM_EN,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  errStatus;
}
/** *****************************************************************************************************
 * \brief This function monitor clock cqm.
 *
 * \verbatim
 * Syntax             : uint8 Mcu_CkgenMonCqm(Mcu_CkgenCqmType *ckgenCqmPtr)
 *
 * Service ID[hex]    : 0x14
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : None
 *
 * Parameters (inout) : ckgenCqmPtr - pointer to ckgencqm struct
 *                      typedef struct
 *                      {
 *                          uint32 base;                (ckgen base )
 *                          uint32 cqmIndex;            (cqmIndex 0/1/2)
 *                          Mcu_CkgenType sliceType;    (slice type )
 *                          uint32 typeIndex;           (slice index )
 *                          uint8 dutyPercent;          (dutyPercent )
 *                          uint8 jitterPercent;        (jitterPercent )
 *                          uint8 dutyIntRes;           (interrupt status, 0-duty within threshold range, 1-duty out of threshold range, 0xFF-error occured )
 *                          uint8 jitterIntRes;         (interrupt status, 0-jitter within threshold range, 1-jitter out of threshold range, 0xFF-error occured )
 *                      } Mcu_CkgenCqmType;
 *
 * Parameters (out)   : None
 *
 * Return value       : clock monitor status
 *                      0 - the monitor status of clock cqm is ok
 *                      !0 - the monitor status of clock cqm is not ok
 *
 * Description        : This function monitor clock cqm.
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
uint8 Mcu_CkgenMonCqm(Mcu_CkgenCqmType *ckgenCqmPtr)
{
    Std_ReturnType errStatus;
    uint8 ret = 0xFFU;

    errStatus = Mcu_EnterCheck(MCU_SID_MONITOR_CQM);

    if (E_OK == errStatus)
    {
        if (NULL_PTR == ckgenCqmPtr)
        {
            errStatus = MCU_E_PARAM_POINTER;
        }
        else
        {
            ret = Mcu_Ip_CkgenDrvMonCqm(ckgenCqmPtr);

            if (0xFFu == ret)
            {
                errStatus = MCU_E_OUTRANGE;
            }
            else
            {
                errStatus = E_OK;
            }
        }
    }

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_CQM,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_MONITOR_CQM,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return  ret;

}

/** *****************************************************************************************************
 * \brief This function kickcore.
 *
 * \verbatim
 * Syntax             : void Mcu_SocKickCore(Mcu_KickCoreType core, uint32 entry)
 *
 * Service ID[hex]    : 0x15
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : core - core to reset
 *                      entry - vector table address for CR52 core and remap address for lp core
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : None
 *
 * Description        : This function kickcore.
 * \endverbatim
 * Traceability       : SW_SM001
 *******************************************************************************************************/
void Mcu_SocKickCore(Mcu_KickCoreType core, uint32 entry)
{
    Std_ReturnType errStatus;
    errStatus = Mcu_EnterCheck(MCU_SID_KICK_CORE);

    if (E_OK == errStatus)
    {
        errStatus = Mcu_Ip_SocKickCore(core, entry);
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_KICK_CORE,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_KICK_CORE,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return;
}

/** *****************************************************************************************************
 * \brief This function read general register value.
 *
 * \verbatim
 * Syntax             : uint32 Mcu_ResetCtlGeneralRead(uint32 id)
 *
 * Service ID[hex]    : 0x16
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : id - general register id
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : general reg value,UINT32_MAX means error
 *
 * Description        : This function read general register value.
 * \endverbatim
 *******************************************************************************************************/
uint32 Mcu_ResetCtlGeneralRead(uint32 id)
{
    uint32 ret = UINT32_MAX;
    uint32 base = APB_RSTGEN_SAFETY_BASE;

    if (id < MCU_RESET_GENERAL_REG_NUM)
    {
        ret = Mcu_Ip_RstgenLldReadGeneralReg(base, id);
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (UINT32_MAX == ret)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GENERAL_READ,
                              (uint8)MCU_E_OUTRANGE);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GENERAL_READ,
                                   (uint8)MCU_E_OUTRANGE);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(ret);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return ret;
}

/** *****************************************************************************************************
 * \brief This function Write general register value.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_ResetCtlGeneralWrite(uint32 id, uint32 val)
 *
 * Service ID[hex]    : 0x17
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : id - general register id
 *                      val - value to write
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errorId
 *                      0 if success,
 *                      other error code.
 *
 * Description        : This function Write general register value.
 * \endverbatim
 *******************************************************************************************************/
Std_ReturnType Mcu_ResetCtlGeneralWrite(uint32 id, uint32 val)
{
    Std_ReturnType errStatus = MCU_E_OUTRANGE;
    uint32 base = APB_RSTGEN_SAFETY_BASE;

    if (id < MCU_RESET_GENERAL_REG_NUM)
    {
        Mcu_Ip_RstgenLldWriteGeneralReg(base, id, val);
        errStatus = E_OK;
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GENERAL_WRITE,
                              (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE, (uint8)MCU_SID_GENERAL_WRITE,
                                   (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return errStatus;
}


/** *****************************************************************************************************
 * \brief This function switch FS24M/32K from RC to xtal.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_FsTrySwitchToXtal(uint32 base)
 *
 * Service ID[hex]    : 0X28
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - APB_FS_24M_BASE/APB_FS_32K_BASE
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errorId
 *                      E_OK for success and others for failure.
 *
 * Description        : This function switch FS24M/32K from RC to xtal.
 * \endverbatim
 * Traceability       : SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_FsTrySwitchToXtal(uint32 base)
{
    Std_ReturnType errStatus;
    errStatus = Mcu_EnterCheck(MCU_SID_SWITCH_TO_XTAL);

    if (E_OK == errStatus)
    {
        if (APB_FS_32K_BASE == base)
        {
            errStatus = Mcu_Ip_Fs32KTrySwitchToXtal();
        }
        else if (APB_FS_24M_BASE == base)
        {
            errStatus = Mcu_Ip_Fs24MTrySwitchToXtal();
        }
        else
        {
            errStatus = MCU_E_PARAM_CONFIG;
        }

    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                              (uint8)MCU_SID_SWITCH_TO_XTAL, (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_SWITCH_TO_XTAL, (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return errStatus;
}

/** *****************************************************************************************************
 * \brief This function switch FS24M/32K from xtal to RC.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_FsTrySwitchToRC(uint32 base)
 *
 * Service ID[hex]    : 0x29
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : base - APB_FS_24M_BASE/APB_FS_32K_BASE
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errorId
 *                      E_OK for success and others for failure.
 *
 * Description        : This function switch FS24M/32K from xtal to RC.
 * \endverbatim
 * Traceability       : SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_FsTrySwitchToRC(uint32 base)
{
    Std_ReturnType errStatus;
    errStatus = Mcu_EnterCheck(MCU_SID_SWITCH_TO_RC);

    if (E_OK == errStatus)
    {
        if (APB_FS_32K_BASE == base)
        {
            errStatus = Mcu_Ip_Fs32KTrySwitchToRC();
        }
        else if (APB_FS_24M_BASE == base)
        {
            errStatus = Mcu_Ip_Fs24MTrySwitchToRC();
        }
        else
        {
            errStatus = MCU_E_PARAM_CONFIG;
        }
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                              (uint8)MCU_SID_SWITCH_TO_RC, (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_SWITCH_TO_RC, (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return errStatus;
}

/** *****************************************************************************************************
 * \brief This function used for debug to pull clock nodes to pad to measure frequency.
 *
 * \verbatim
 * Syntax             : Std_ReturnType Mcu_CkgenClockToPad(const Mcu_ClkNodeType *ckgenPtr, uint8 divNum)
 *
 * Service ID[hex]    : 0x30
 *
 * Sync/Async         : Synchronous
 *
 * Reentrancy         : Non reentrant
 *
 * Parameters (in)    : ckgenPtr - clock note with type Mcu_CkgenNodeType defined in "Mcu_ClkCfgNode.h"
 *                      divNum - frequency division, [1,15]
 *
 * Parameters (inout) : None
 *
 * Parameters (out)   : None
 *
 * Return value       : errorId
 *                      E_OK for success and others for failure.
 *
 * Description        : This function used for debug to pull clock nodes to pad to measure frequency.
 *                      GPIO_A9/A10/A11 need MUX CKGEN_SF.CLK_DBG, GPIO_LA4/LA5/LA6 need MUX CKGEN_LPP.CLK_DBG
 *
 * \endverbatim
 * Traceability       : SWSR_MCU_049 SW_SM001
 *******************************************************************************************************/
Std_ReturnType Mcu_CkgenClockToPad(const Mcu_ClkNodeType *ckgenPtr, uint8 divNum)
{
    Std_ReturnType errStatus;
    errStatus = Mcu_EnterCheck(MCU_SID_CLOCK_TO_PAD);

    if (E_OK == errStatus)
    {
        errStatus = Mcu_Ip_CkgenClockToPad(ckgenPtr, divNum);
    } /* else not needed */

    /* ----- Development Error Report --------------------------------------- */
    /* #90 Report errors if any occurred */
#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE))

    if (E_OK != errStatus)
    {
#if (STD_ON == MCU_DEV_ERROR_DETECT)
        (void)Det_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                              (uint8)MCU_SID_CLOCK_TO_PAD, (uint8)errStatus);
#endif /** if (STD_ON == MCU_DEV_ERROR_DETECT) */
#if (STD_ON == MCU_SAFETY_ENABLE)
        (void)FuSaMcal_ReportError((uint16)MCU_MODULE_ID, (uint8)MCU_INSTANCE,
                                   (uint8)MCU_SID_CLOCK_TO_PAD, (uint8)errStatus);
#endif /** if (STD_ON == MCU_SAFETY_ENABLE) */
    }/* else not needed */

#else
    {
        /* #100 Dummy assignment avoid compiler warning */
        MCU_DUMMY_STATEMENT(errStatus);
    }
#endif /**#if ((STD_ON == MCU_DEV_ERROR_DETECT) || (STD_ON == MCU_SAFETY_ENABLE)) */
    return errStatus;
}

#define MCU_STOP_SEC_CODE
#include "Mcu_MemMap.h"

#ifdef __cplusplus
}
#endif
